<template>
<div class="advanced-search-box">
    <div class="msg-content">
      {{msg}}
    </div>
    <div class="foot-btn-box">
      <RPButton btnType="default" text="取消" @click="handleClose"/>
      <RPButton btnType="primary" :text="notModifyAndSubmitButtonText" @click="handleNotModifyAndSubmit"/>
      <RPButton btnType="primary" :text="modifyAndSubmitButtonText" @click="handleModifyAndSubmit"/>
    </div>
</div>
</template>
<script>
import {
  PROCESS_STATUS_WAIT_SUBMIT,
  PROCESS_STATUS_WAIT_APPROVE,
} from '@/tools/common.js'
export default {
  name: 'diffrentQuarterConfirm',
  props: {
    fromAction: {
      type: String,
      default: ''
    },
    data: {
      type: Object,
      default: () => {}
    },
    configQuarter: {
      type: String,
      default: ''
    },
  },
  data() {
    return {
      info: {}
    }
  },
  computed: {
    msg() {
      if (this.fromAction == 'updateProgress') {
        if (this.data.wfStatus == PROCESS_STATUS_WAIT_APPROVE) {
          return `您填写的季度与当前填报周期不一致，是否按照${this.configQuarter}季度进行修改并提交？`
        } else if (this.data.wfStatus == PROCESS_STATUS_WAIT_SUBMIT) {
          return `您填写的季度与当前填报周期不一致，是否按照${this.configQuarter}季度进行修改并保存？`
        }
      } else if (this.fromAction == 'import') {
        return this.data.msg
      } else if (this.fromAction == 'batchSubmit') {
        return `您选择的数据中有填写的季度与当前填报周期不一致的情况，是否按照${this.configQuarter}季度进行修改并提交？`
      } else {
        return ''
      }
    },
    notModifyAndSubmitButtonText() {
      if (this.fromAction == 'updateProgress') {
        if (this.data.wfStatus == PROCESS_STATUS_WAIT_APPROVE) {
          return '保持并提交'
        } else if (this.data.wfStatus == PROCESS_STATUS_WAIT_SUBMIT) {
          return '保存'
        }
      } else if (this.fromAction == 'import') {
        return '保存'
      } else if (this.fromAction == 'batchSubmit') {
        return '保持并提交'
      } else {
        return ''
      }
    },
    modifyAndSubmitButtonText() {
      if (this.fromAction == 'updateProgress') {
        if (this.data.wfStatus == PROCESS_STATUS_WAIT_APPROVE) {
          return '修改并提交'
        } else if (this.data.wfStatus == PROCESS_STATUS_WAIT_SUBMIT) {
          return '修改并保存'
        }
      } else if (this.fromAction == 'import') {
        return '修改并保存'
      } else if (this.fromAction == 'batchSubmit') {
        return '修改并提交'
      } else {
        return ''
      }
    },
  },
  created() {
     this.$emit("SetTitle", "温馨提示");
     this.$emit("SetPageMinHeight", 100);
     this.$emit("SetPageWidth", 550);
     this.info = {...this.data}
  },
  methods: {
    handleClose() {
      this.$emit("Close",false);
    },
    // 保持并提交
    handleNotModifyAndSubmit() {
      this.info.actionSource = 'NotModifyAndSubmit'
      this.$emit("Close", this.info)
    },
    // 修改并提交
    handleModifyAndSubmit() {
      this.info.actionSource = 'ModifyAndSubmit'
      this.$emit("Close", this.info)
    },
  }
}
</script>
<style lang="less" scoped>
.advanced-search-box {
  .foot-btn-box {
    padding-top: 30px;
    text-align: right;
    button {
      margin-left: 10px;
    }
  }
  /deep/.core-modal-footer {
    padding: 0;
  }
  
  .Selecequarters{
    display:flex;
    
  
    /deep/.ivu-form-item-content{
          margin-left: 2px;
          width: 200px;
  
    }
  }
}
</style>

